import os
import time
import ddddocr
import pyperclip
from appium.webdriver.common.touch_action import TouchAction
from selenium.webdriver.common.action_chains import ActionChains
import pyautogui
from selenium import webdriver
from selenium.webdriver.common.by import By

from config import FMT_PATH, BASE_DIR

store_9528 = "http://cymtest.piccmall.cn:9528/login"
store_9529 = "http://cymtest.piccmall.cn:9529/login"
store_9531 = "http://cymtest.piccmall.cn:9531/login"


driver = webdriver.Chrome(executable_path=r"F:\work\driver\chrome\113\chromedriver.exe")
driver.maximize_window()
driver.implicitly_wait(10)

driver.get(store_9531)
time.sleep(2)
driver.execute_script("document.body.style.zoom='0.5'")
# element = driver.find_element(By.XPATH,'//*[@id="app"]/div/div/div/div[1]/div[7]/div/div[1]/div[3]/div[1]/div/img')
# driver.execute_script("arguments[0].scrollIntoView();", element)
time.sleep(3)

ele =driver.find_element_by_xpath('//*[@id="app"]/div/div/div/div[1]/div[7]/div/div[1]/div[3]/div[1]/div/img')


driver.execute_script("arguments[0].click();", ele)

time.sleep(5)
driver.execute_script("document.body.style.zoom='1.0'")
driver.find_elements_by_xpath("//*[text() = '立即购买']")[0].click()
# time.sleep(17)
print(driver.window_handles)
time.sleep(2)
driver.find_elements_by_xpath('//*[text() = "我已阅读并同意以上政策"]')[2].click()
driver.execute_script("document.body.style.zoom='0.8'")
time.sleep(17)
driver.find_element_by_xpath('//*[text() = "同意并继续"]').click()
